function choiceWebNet(flag) {
    if(flag==2) {
        document.getElementById("hreftocom").className = "phoneweb_en";
        document.getElementById("hreftocn").className = "phoneweb_ch";
        window.location.href = "https://www.okcoin.com";
    }else {
        document.getElementById("hreftocn").className = "phonewebinter_ch";
        document.getElementById("hreftocom").className = "phonewebinter_en";
        window.location.href = "https://www.okcoin.cn";
    }
}
function logout() {
    window.location.href = "/mobile/logout.do?random="+Math.round(Math.random()*100);
}

function mobileindexloginSubmit(){
    var uName = document.getElementById("loginUserName").value;
    var pWord = document.getElementById("loginPassword").value;
    var loginUrl = "/mobile/showLogin.do?random="+Math.round(Math.random()*100);
    if(uName=="") {
        window.location.href = loginUrl + "&loginErrorMsg=1";
        return;
    }
    if(!checkEmail(uName)) {
        window.location.href = loginUrl + "&loginErrorMsg=2";
        return;
    }
    if(pWord=="") {
        window.location.href = loginUrl + "&loginErrorMsg=3";
        return;
    }
    if(pWord.length<6) {
        window.location.href = loginUrl + "&loginErrorMsg=4";
        return;
    }
    if(pWord.length>32) {
        window.location.href = loginUrl + "&loginErrorMsg=5";
        return;
    }

    var url = "/mobile/login.do?random="+Math.round(Math.random()*100);
    var longLogin = 0;
    if(document.getElementById("longLogin")!=null && document.getElementById("longLogin").checked){
        longLogin = 1;
    }
    var param={loginName:uName,password:pWord,longLogin:longLogin};
    jQuery.post(url,param,function(data){
        var result = eval('(' + data + ')');
        if(result!=null){
            if(result.resultCode == 0){
                window.location.href = "/?random="+Math.round(Math.random()*100);
            }else if(result.resultCode == -1){
                window.location.href = loginUrl + "&loginErrorMsg=6";
            }else if(result.resultCode == -2){
                window.location.href = loginUrl + "&loginErrorMsg=7";
            }else if(result.resultCode == -3){
                if(result.errorNum == 0){
                    window.location.href = loginUrl + "&loginErrorMsg=7";
                }else{
                    window.location.href = loginUrl + "&loginErrorMsg=err" + result.errorNum;
                }
            }else if(result.resultCode == -4){
                window.location.href = loginUrl + "&loginErrorMsg=8";
            }else if(result.resultCode == 1){
                window.location.href = loginUrl;
            }else if(result.resultCode == 2){
                window.location.href = loginUrl + "&loginErrorMsg=9";
            }

        }
    });
}
function forward_index(type){
		window.location.href = "/forwardIndex.do?forward_index="+type;
}
